#include "Configuration.h"

Configuration::Configuration(const char* fileName)
{
	FILE *f = fopen(fileName,"r");	
	if (f == NULL)
	{
		printf("Error While Opening File: %s \n",fileName);
	}
	else
	{
		/***********************************
		* PageSize = [integer]
		* NumOfKernelPagesInMM = [integer]
		* NumOfUserPagesInMM = [integer] 
		* NumOfKernelPagesInDisk = [integer]
		* NumOfUserPagesInDisk = [integer] 
		* AlgorithmForUser = [WSClock/FIFO]
		* AlgorithmForKernel = [WSClock/FIFO]
		* WSClockDelta = [integer]
		*************************************/

		printf("Intializing System:\n");

		fscanf(f,"PageSize = %d\n",&PageSize);		
		printf("PageSize = %d\n",PageSize);	

		fscanf(f,"NumOfKernelPagesInMM = %d\n",&NumOfKernelPagesInMM);	
		printf("NumOfKernelPagesInMM = %d\n",NumOfKernelPagesInMM);

		fscanf(f,"NumOfUserPagesInMM = %d\n",&NumOfUserPagesInMM);
		printf("NumOfUserPagesInMM = %d\n",NumOfUserPagesInMM);

		fscanf(f,"NumOfKernelPagesInDisk = %d\n",&NumOfKernelPagesInDisk);	
		printf("NumOfKernelPagesInDisk = %d\n",NumOfKernelPagesInDisk);	

		fscanf(f,"NumOfUserPagesInDisk  = %d\n",&NumOfUserPagesInDisk );	
		printf("NumOfUserPagesInDisk  = %d\n",NumOfUserPagesInDisk );	

		fscanf(f,"AlgorithmForUser = %d\n",&AlgorithmForUser);	
		printf("AlgorithmForUser = %d\n",AlgorithmForUser);

		fscanf(f,"AlgorithmForKernel = %d\n",&AlgorithmForKernel);
		printf("AlgorithmForKernel = %d\n",AlgorithmForKernel);

		fscanf(f,"WSClockDelta = %d\n",&WSClockDelta);	
		printf("WSClockDelta = %d\n",WSClockDelta);	

		fclose(f);
	}
}

Configuration::~Configuration(void)
{
}
